import api from '../../api/index'
Page({
  data: {
    list: [],
    items: {
      title: '西安校友会成功举办“翠华寻春健步行”活动',
      url: '/assets/images/common/banner.png',
      id: 1,
      content: '最是一年春好处，绝胜烟柳满皇都”。四月的古都西安，花红柳绿，春意盘然。为了但进炼',
      time: '2023-08-11'
    },
    isBottom: false
  },
  onLoad(options) {
    this.getList()
  },
  onReady() {

  },
  onShow() {

  },
  onHide() {

  },
  onUnload() {

  },
  onReachBottom() {
    const { isBottom, list } = this.data
    if (isBottom) return
    this.setData({ isBottom: true })
    this.getList()
  },
  gotoDetail(e) {
    const { id } = e.currentTarget.dataset
    wx.navigateTo({ url: `/pages/alumni-detail/alumni-detail?id=${id}` })
  },
  getList(params) {
    const { list } = this.data
    api.base.fellowStyle(params).then(res => {
      console.log(res);
      const datalist = list.concat(res.records)
      const isBottom = res.total >= datalist.length ? false : true
      this.setData({ list: datalist, isBottom })
    })
  }
})